<?php
class YachtsHelper extends AppHelper{
	var $helpers = array('Html', 'Form','Tree','Session','Number','Javascript');
	
	function beforeRender(){
		parent::beforeRender();
	
		App::import('Component', 'Yachts');
		$this->Yachts = new YachtsComponent;
	
		$this->View =& ClassRegistry::getObject('view');
			
	}
		
	public function destination(){
		return $this->Yachts->destination();
	}
	
	public function search_form_left(){
		return $this->View->element('search-form-left',array('plugin'=>false,'destination'=>$this->Yachts->destination()));
	}
	
	public function bases(){
		return $this->View->element('select_bases',array('plugin'=>false,'destination'=>$this->Yachts->destination()));
	}
	
	public function destination_menu(){
		return $this->View->element('destination_menu',array('plugin'=>false,'destinations'=>$this->Yachts->destination_menu()));
	}
	
	public function bases_menu(){
		return $this->View->element('bases_menu',array('plugin'=>false,'destinations'=>$this->Yachts->destination_menu()));
	}
	
	public function maxDateForPrice(){
		return $this->Yachts->maxDateForPrice();
	}
	
	public function lastminute(){
		$items = $this->Yachts->lastminute(array('limit'=>10));
		return $this->View->element('lastminute_samall',array('plugin'=>false,'items'=>$items));
	}
	
	
	public function passengers(){
		return array(1=>'1',2=>'2',3=>'3',4=>'4',5=>'5',6=>'6',7=>'7',8=>'8',9=>'9',10=>'10',11=>'11',12=>'12',13=>'13',14=>'14',15=>'15',16=>'16',17=>'17',18=>'18',19=>'19',20=>'20');
	}
	
	
	
	public function durations(){
		return array('5'=>__('5 days',true),'6'=>__('6 days',true),'7'=>__('7 days',true),'8'=>__('8 days',true),'9'=>__('9 days',true),'10'=>__('10 days',true),'11'=>__('11 days',true),'12'=>__('12 days',true),'13'=>__('13 days',true),'14'=>__('14 days',true),'15'=>__('15 days',true),'16'=>__('16 days',true),'17'=>__('17 days',true),'18'=>__('18 days',true),'19'=>__('19 days',true),'20'=>__('20 days',true),'21'=>__('21 days',true),'22'=>__('22 days',true),'23'=>__('23 days',true),'24'=>__('24 days',true),'25'=>__('25 days',true),'26'=>__('26 days',true),'27'=>__('27 days',true),'28'=>__('28 days',true),'29'=>__('29 days',true),'30'=>__('30 days',true),'31'=>__('31 days',true));
	}
	
	public function per(){
		return array('1'=>__('per charter',true),'2'=>__('per person per day',true),'3'=>__('per day',true),'4'=>__('per person',true));
	}

	public function weekly_days(){
		return array('1'=>__('Monday',true),'2'=>__('Tuesday',true),'3'=>__('Wednesday',true),'4'=>__('Thursday',true),'5'=>__('Friday',true),'6'=>__('Saturday',true),'7'=>__('Sunday',true));
	}
	
	public function charter_status($id=null){
		$statusy = array('0'=>__('New charter',true),'1'=>__('Waiting for provider offer',true),'2'=>__('Waiting for customer akceptations',true),'3'=>__('Custommer akcept offer.',true),'4'=>__('Partial payment for the charter',true),'5'=>__('The order closed',true),'11'=>__('Resignation of Member',true),'12'=>__('Resignation of Provider',true),'13'=>__('Peyments error',true));
		if(is_null($id)){
			return $statusy;
		}else{
			if(array_key_exists($id,$statusy)){
				return $statusy[$id];
			}
		}
	}
	
	public function booking_top(){
		$yachtCharter = $this->Session->read('YachtCharter');
		if(is_array($yachtCharter) && !empty($yachtCharter)){
			return $this->View->element('booking_link');
		}
	}
}